local skel = fk.CreateSkill{
  name = "knu_bitu",
}

Fk:loadTranslationTable{
  ["knu_bitu"] = "彼途",
  [":knu_bitu"] = "当你的体力值变化后，你可以摸一张牌并展示之，此牌于本回合视为【毒】，于下回合视为【桃】。",

  ["@@knu_bitu-inhand"] = "彼途",

  ["$knu_bitu1"] = "逆臣见迫兮，痛饮鸩酒。",
  ["$knu_bitu2"] = "药毒入髓兮，独赴泉台。",

}

skel:addEffect(fk.HpChanged, {
  can_trigger = function(self, event, target, player, data)
    return target == player and player:hasSkill(skel.name)
  end,
  on_use = function(self, event, target, player, data)
    local c = player:drawCards(1,skel.name,"top",{"@@knu_bitu-inhand",2})
    player.room:showCards(c,player)
  end,
})

skel:addEffect(fk.BeforeTurnStart,{
  mute = true,
  can_refresh = function (self, event, target, player, data)
    return player:hasSkill(skel.name)
  end,
  on_refresh = function (self, event, target, player, data)
    for _,cid in ipairs(player:getCardIds("h")) do
      local c = Fk:getCardById(cid)
      local n = c:getMark("@@knu_bitu-inhand")
      if n > 0 then
        player.room:setCardMark(c,"@@knu_bitu-inhand",n - 1)
      end
    end
  end,
})

skel:addEffect("filter", {
  mute = true,
  card_filter = function(self, card, player)
    return card:getMark("@@knu_bitu-inhand") > 0
  end,
  view_as = function(self, player, card)
    if card:getMark("@@knu_bitu-inhand") > 1 then
      return Fk:cloneCard("es__poison", card.suit, card.number)
    else
      return Fk:cloneCard("peach", card.suit, card.number)
    end
  end,
})

return skel